// stores/user.ts
import { defineStore } from 'pinia'

export const useSysStore = defineStore('title', {
    state:()=>({
        title:import.meta.env.VITE_SYSNAME as string,
        breadCrumb:[] as string[],
        defaultOpenMenu:[] as string[]
    }),
    getters:{
        getTitle:(state):string=>{
            //not prod  then add about info
            if(import.meta.env.MODE != 'prod')
                return import.meta.env.MODE + state.title;
            return state.title;
        },
        getBreadCrumb:(state):string[]=>{
            return state.breadCrumb;
        },
        getDefaultOpenMenu:(state):string[]=>{
            return state.defaultOpenMenu;
        },
    },
    actions:{
        setTitle(title:string){
            this.$state.title = title
        },
        setDefaultOpenMenu(defaultOpenMenu:string[]){
            this.$state.defaultOpenMenu = defaultOpenMenu
        },
        setBreadCrumb(breadCrumb:string[]){
            this.$state.breadCrumb = breadCrumb
        }
    }
})